package com.aspose.cells;

class zbzy extends zcdb {
   zcdb a;
   zcdb b;
   private Workbook e;
   private zazj f;

   zbzy(zazj var1, Workbook var2) throws Exception {
      this.d = 409;
      this.f = var1;
      this.e = var2;
      this.a();
   }

   private void a() throws Exception {
      if (this.f.q != null) {
         this.b = this.a(this.f.q);
      }

      if (this.f.p != null) {
         this.a = this.a(this.f.p);
      }

      int var1 = 34;
      if (this.f.t != null) {
         var1 += this.f.t.length * 100;
      }

      this.c = new byte[var1];
      zbaa var2 = new zbaa(this.f);
      int var3 = var2.a(this.c);
      System.arraycopy(com.aspose.cells.b.a.zc.a(this.f.b()), 0, this.c, var3, 4);
      var3 += 4;
      System.arraycopy(com.aspose.cells.b.a.zc.a(this.f.c()), 0, this.c, var3, 4);
      var3 += 4;
      int var4 = 0;
      boolean var5 = false;
      if (this.f.q != null) {
         int var7 = zcdf.a(this.f.q);
         var4 |= var7;
      }

      if (this.f.p != null) {
         var4 |= zcdf.a(this.f.p) << 3;
      }

      if (this.f.i) {
         var4 |= 64;
      }

      if (this.f.g) {
         var4 |= 128;
      }

      if (this.f.c) {
         var4 |= 256;
      }

      if (this.f.r != null) {
         var4 |= 512;
      }

      if (this.f.o) {
         var4 |= 1024;
      }

      if (this.f.l) {
         var4 |= 2048;
      }

      if (this.f.b) {
         var4 |= 4096;
      }

      if (this.f.s != null) {
         var4 |= 8192;
      }

      System.arraycopy(com.aspose.cells.b.a.zc.a(var4), 0, this.c, var3, 2);
      var3 += 2;
      var4 = 0;
      int var6 = this.f.e;
      if (var6 > 0 && var6 <= 59) {
         this.c[var3] = (byte)var6;
      }

      ++var3;
      if (this.f.h) {
         var4 |= 1;
      }

      if (this.f.f) {
         var4 |= 2;
      }

      if (this.f.d) {
         var4 |= 4;
      }

      if (this.f.p != null) {
         var4 |= 8;
      }

      this.c[var3] = (byte)var4;
      ++var3;
      if (this.a != null) {
         System.arraycopy(com.aspose.cells.b.a.zc.a(this.a.c.length), 0, this.c, var3, 4);
      }

      var3 += 4;
      zcdf.a(this.c, var3, this.f.t);
   }

   private zcdb a(zazl var1) throws Exception {
      zcdb var2 = null;
      int var3 = 8;
      int var4 = 0;
      if (var1.h != null) {
         var4 = 2 + var1.h.length;
      }

      byte[] var5 = null;
      switch(var1.b()) {
      case 0:
         var2 = new zcdb(var4 == 0 ? 4 : 10);
         ++var3;
         var5 = new byte[var3 + var4];
         this.a(var1, var5);
         if ((Boolean)var1.e) {
            var5[8] = 1;
         }
         break;
      case 1:
      case 4:
         var2 = new zcdb(var4 == 0 ? 5 : 9);
         var3 += 8;
         var5 = new byte[var3 + var4];
         this.a(var1, var5);
         double var9 = var1.c();
         System.arraycopy(com.aspose.cells.b.a.zc.a(var9), 0, var5, 8, 8);
         break;
      case 2:
         var2 = new zcdb(var4 == 0 ? 3 : 11);
         ++var3;
         var5 = new byte[var3 + var4];
         this.a(var1, var5);
         var5[8] = zsk.a((String)var1.e);
         break;
      case 3:
         if (var4 == 0) {
            var2 = new zcdb(1);
            var5 = new byte[var3 + var4];
         } else {
            var2 = new zcdb(9);
            var3 += 8;
            var5 = new byte[var3 + var4];
         }

         this.a(var1, var5);
         break;
      case 5:
         var2 = new zcdb(var4 == 0 ? 62 : 8);
         zcdh var6 = new zcdh();
         if (var4 == 0) {
            zayy var7 = (zayy)var1.e;
            if (var7.f()) {
               var6.a((zbap)var7, this.e);
            } else {
               var6.a(var7.c);
            }
         } else {
            var6.a((String)var1.d());
         }

         var3 += var6.c.length;
         var5 = new byte[var3 + var4];
         this.a(var1, var5);
         System.arraycopy(var6.c, 0, var5, 8, var6.c.length);
      }

      if (var5 != null && var4 != 0) {
         System.arraycopy(com.aspose.cells.b.a.zc.a(var1.i), 0, var5, var3, 2);
         System.arraycopy(var1.h, 0, var5, var3 + 2, var1.h.length);
      }

      if (var2 != null) {
         var2.c = var5;
      }

      return var2;
   }

   private void a(zazl var1, byte[] var2) {
      System.arraycopy(com.aspose.cells.b.a.zc.a(var1.c), 0, var2, 0, 2);
      byte var3 = 0;
      System.arraycopy(com.aspose.cells.b.a.zc.a((int)var3), 0, var2, 4, 4);
   }
}
